package com.android.wellcherish.workclock.util;

import com.android.wellcherish.workclock.constant.Mode;

/**
 * @author 张文琛
 * @date 2020/3/15 16:26
 */
public class ModeUtil {
    /**
     * 判断是否是折叠态
     * */
    public static boolean isFoldMode(int mode) {
        if(mode < 0) {
            return false;
        }

        return (mode & Mode.FOLD) == Mode.FOLD;
    }
    /**
     * 判断是否非折叠态
     * */
    public static boolean isUnfoldMode(int mode) {
        if(mode < 0) {
            return false;
        }

        return (mode & Mode.UNFOLD) == Mode.UNFOLD;
    }

    /**
     * 判断是否是头布局
     * */
    public static boolean isHead(int mode) {
        if(mode < 0) {
            return false;
        }

        return (mode & Mode.HEAD) == Mode.HEAD;
    }

    /**
     * 判断是否是内容布局
     * */
    public static boolean isContent(int mode) {
        if(mode < 0) {
            return false;
        }

        return (mode & Mode.CONTENT) == Mode.CONTENT;
    }

    /**
     * 判断srcMode是否包含某个tarMode
     *
     * */
    public static boolean isContainMode(@Mode int srcMode, @Mode int tarMode) {
        return (srcMode & tarMode) == srcMode;
    }
}
